/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.plt.be;

import edu.upn.sigemfi.seg.be.Persona;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Gerard
 */
@Entity
@Table(name = "PLT_CLIENTE")
@NamedQueries({@NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c"), @NamedQuery(name = "Cliente.findByIdCliente", query = "SELECT c FROM Cliente c WHERE c.idCliente = :idCliente"), @NamedQuery(name = "Cliente.findByFechaRegistro", query = "SELECT c FROM Cliente c WHERE c.fechaRegistro = :fechaRegistro")})
@PrimaryKeyJoinColumn(name = "ID_CLIENTE", referencedColumnName = "ID_PERSONA")
@DiscriminatorValue("CLT")
public class Cliente
        extends Persona
        implements Serializable {

    @Basic(optional = false)
    @Column(name = "FECHA_REGISTRO", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaRegistro;
    @Lob
    @Column(name = "FOTO")
    private byte[] foto;
    @Lob
    @Column(name = "FIRMA")
    private byte[] firma;
    @OneToMany(mappedBy = "fidPltCliente", fetch = FetchType.LAZY)
    private List<SolicitudChequera> solicitudChequeraCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente", fetch = FetchType.LAZY)
    private List<DetalleSeguro> detalleSeguroCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente", fetch = FetchType.LAZY)
    private List<DetalleCuentaCliente> detalleCuentaClienteCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fidPltCliente", fetch = FetchType.LAZY)
    private List<TarjetaDebito> tarjetaDebitoCollection;

    public Cliente() {
    }

    public Date getFechaRegistro() {
        return fechaRegistro;
    }

    public void setFechaRegistro(Date fechaRegistro) {
        this.fechaRegistro = fechaRegistro;
    }

    public byte[] getFoto() {
        return foto;
    }

    public void setFoto(byte[] foto) {
        this.foto = foto;
    }

    public byte[] getFirma() {
        return firma;
    }

    public void setFirma(byte[] firma) {
        this.firma = firma;
    }

    public List<SolicitudChequera> getSolicitudChequeraCollection() {
        return solicitudChequeraCollection;
    }

    public void setSolicitudChequeraCollection(List<SolicitudChequera> solicitudChequeraCollection) {
        this.solicitudChequeraCollection = solicitudChequeraCollection;
    }

    public List<DetalleSeguro> getDetalleSeguroCollection() {
        return detalleSeguroCollection;
    }

    public void setDetalleSeguroCollection(List<DetalleSeguro> detalleSeguroCollection) {
        this.detalleSeguroCollection = detalleSeguroCollection;
    }

    public List<DetalleCuentaCliente> getDetalleCuentaClienteCollection() {
        return detalleCuentaClienteCollection;
    }

    public void setDetalleCuentaClienteCollection(List<DetalleCuentaCliente> detalleCuentaClienteCollection) {
        this.detalleCuentaClienteCollection = detalleCuentaClienteCollection;
    }

    public List<TarjetaDebito> getTarjetaDebitoCollection() {
        return tarjetaDebitoCollection;
    }

    public void setTarjetaDebitoCollection(List<TarjetaDebito> tarjetaDebitoCollection) {
        this.tarjetaDebitoCollection = tarjetaDebitoCollection;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Persona other = (Persona) obj;
        if (this.idPersona != other.getIdPersona() && (this.idPersona == null || !this.idPersona.equals(other.getIdPersona()))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 83 * hash + (this.idPersona != null ? this.idPersona.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.seg.be.Persona[idPersona=" + idPersona + "]";
    }
}
